package com.niiwoo.civet.account.service;

import com.niiwoo.civet.account.dto.common.AccountBatchTransOrderDTO;
import com.niiwoo.civet.account.dto.common.AsyncTransactionNotifyDTO;
import com.niiwoo.civet.account.enums.CanRefundEnum;
import com.niiwoo.civet.account.enums.OrderEndTypeEnum;
import com.niiwoo.civet.account.enums.RefundStatusEnum;
import com.niiwoo.civet.base.enums.RefundBizStatusEnum;

import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * 还款订单推送
 * Created by fushengcai on 2017/11/10.
 */
public interface AccountRefundOrderPushDubboService {
    /**
     * 按批次号同步还款结果
     * @param batchNo
     */
    void syncTransationStatuByBatchNo(String batchNo);

    /**
     * 同步还款结果
     * 24小以内，且30分钟以上还在处理中的
     */
    void syncTransationStatuAll();

    /**
     * 异步(job调用)
     * @param dtoList
     * @param isWithHold
     * @throws ExecutionException
     * @throws InterruptedException
     */
    void pushTransOrderNew(List<AccountBatchTransOrderDTO> dtoList, boolean isWithHold) throws ExecutionException, InterruptedException;


    /**
     * 同步(web接口)
     * @param dto
     * @param isNeedWithhold
     * @return
     * @throws ExecutionException
     * @throws InterruptedException
     */
    RefundBizStatusEnum pushTransOrderSyncNew(AccountBatchTransOrderDTO dto, boolean isNeedWithhold) throws ExecutionException, InterruptedException;

    /**
     * 还款回调入口
     * @param list
     */
    void refundCallBackNew(List<AsyncTransactionNotifyDTO> list);


    /**
     * 还款补单
     * @throws ExecutionException
     * @throws InterruptedException
     */
    void complateRefund() throws ExecutionException, InterruptedException;

    /**
     * 验证是否能操作借款单
     * @param projectId
     * @param currentPeriod
     * @return
     */
    CanRefundEnum checkProjectCanRefundByType(Long projectId,Integer currentPeriod,Byte type);

    /**
     * 回滚还款（冻结预处理）
     * @param proTransactionOrderId
     * @return
     */
    boolean rollbackProtransaction(Long proTransactionOrderId);

    /**
     * 神盾（代扣）
     * @param withholdOrderId
     * @param status
     * @param endType
     */
    void complementWithhold(Long withholdOrderId, RefundStatusEnum status, OrderEndTypeEnum endType);
}
